﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class login : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
   
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (yan.Text.ToString() == Session["valid"].ToString())
        {
            DataClassesDataContext a1 = new DataClassesDataContext();
            int? i;
            i = a1.select_teacher(yong.Text, mi.Text);
            if (i == 1)
            {
                Response.Redirect("dba.aspx");
            }
            else
            {
                i = a1.login(yong.Text, yong.Text, mi.Text);
                if (i == 1)
                {
                    Session["phone"] = yong.Text;
                    Session["psw"] = mi.Text;
                    Response.Redirect("geren_information.aspx");
                    //Response.Write("<script>alert('登陆成功');</script>");
                }
                else
                {
                    Response.Write("<script>alert('密码错误!');</script>");
                    Response.Redirect("homepage.aspx");
                }
            }
        }
        else
        {
            Response.Write("<script>alert('验证码错误！');location='homepage.aspx'</script>");
            //Response.Redirect("homepage.aspx");
        }
    }
    protected void yong_TextChanged(object sender, EventArgs e)
    {

    }
}